{% extends 'AdminBundle::layout.html.twig' %}


{% block title %}科技联络人审核{% endblock %}

{% block css %}{% endblock %}


{% block top %}
    {#{{ dump() }}#}
    {{ parent() }}
{% endblock %}


    {% block left_body_top %}
        {{ parent() }}
    {% endblock %}

    {% block left_body %}
        {{ parent() }}
    {% endblock %}

    {% block right_body %}
    <div class="page-header">
        <div class="page-right-top">
            <div class="right-top">
                <span class="right-title">账号管理</span>
            </div>
            <div class="top-nav top-nav-active">科技联络人审核</div>
        </div>
        <div class="main-content">
            <div class="main-top">
                <div class="index-list member-m1">
                    <div class="index-total">待审核科技联络人数</div>
                    <div class="index-totalNum">
                        <span class="check-count"></span>个
                    </div>
                </div>
                <div class="index-list member-m2">
                    <div class="index-total" style="padding-top: 13px;">已同意科技联络人数</div>
                    <div class="index-totalNum">
                        <span class="is-teac-count"></span>个
                    </div>
                </div>
                <div class="index-list member-m3">
                    <div class="index-total">已拒绝科技联络人数</div>
                    <div class="index-totalNum">
                        <span class="is-refuse"></span>个
                    </div>
                </div>
            </div>

            <div class="mes-content">

                <div class="main-mes-content">
                    <div class="al-released fl">科技联络人审核列表</div>

                    <table class="table" style="table-layout:fixed;">
                        <thead>
                        <tr style="background-color: #f3f9fd;">
                            <th width="8%;" class="center-th">序号</th>
                            <th width="12%" class="center-th">姓名</th>
                            <th width="12%" class="center-th">手机号</th>
                            <th width="22%" class="center-th">公司名称</th>
                            <th class="center-th">操作</th>
                        </tr>
                        </thead>
                        <tbody>


                        </tbody>
                    </table>

                    <div class="page-box">
                        <ul class="pagination">


                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% endblock %}


{% block box %}
{% endblock %}


{% block javascript %}
    {{ parent() }}
<script type="text/javascript">
//    $(function () {

        SidebarHighlighting('7');

        SonSidebar('7', '2');

        $("body").on("click",".table-opera",function(){
            var id = $(this).data("id");
            var company_id = $(this).data("companyid");
            var status = $(this).data("status");

            if(status == 1){
                var key = "您确定要同意吗？";
            } else if(status == 2){
                var key = "您确定要删除吗？";
            } else if(status == -1){
                var key = "您确定要拒绝吗？";
            }

            if(confirm(key)) {

                $.post("{{ path('api_admin_setting_technology_liaisons') }}",{id:id,status:status,company_id:company_id},function(data){

                    console.log(data);
                    if(data.errorCode == 0){
                        popStatus(1, data.message, 1,'', true);
                        $("table tbody").empty();
                        page_times = 0;
                        getList(1);
                    } else {
                        popStatus(2, data.message, 1,'', true);
                    }
                })


            }

        })


        // 获取科技联络人列表
        var page_times = 0;
        function getList(page){
            page_times++;

            var prame = {page:page};

            $.post("{{ path('api_admin_setting_technology_liaisons_list') }}",prame,function (data) {

                console.log(data);

                var list_all_count = data.data.search_all_count;
                var allpage = data.data.all_page;

                // 分页样式
                if(page_times == 1 && allpage > 0){
                    pageAction(list_all_count,allpage);
                }

                //待审核数量
                $(".check-count").text(data.data.check_count);

                // 已同意数量
                $(".is-teac-count").text(data.data.is_teac_count);

                //已拒绝
                $(".is-refuse").text(data.data.is_refuse);

                var item = data.data.data;
                for(var i in item){
                    var html = '';
                    var key = parseInt(i)+1;

                    var list_order_num = parseInt((parseInt(page)-1)*10+key);

                    html += '<tr>';
                    html += '<td class="a-line center-th">'+ list_order_num +'</td>';
                    html += '<td class="center-th">'+ item[i].name +'</td>';
                    html += '<td class="center-th">'+ item[i].phone +'</td>';
                    html += '<td class="center-th">'+ item[i].company_full_name +'</td>';
                    html += '<td class="center-th">';
                    html += '<span class="table-opera ta-reset" data-id="'+ item[i].id +'" data-status="1" data-companyid="'+ item[i].company_id +'">同意 |</span>';
                    html += '<span class="table-opera tab-edit" data-id="'+ item[i].id +'" data-status="-1" data-companyid="'+ item[i].company_id +'">拒绝 |</span>';
                    html += '<span class="table-opera tab-disable" data-id="'+ item[i].id +'" data-status="2" data-companyid="'+ item[i].company_id +'">删除</span>';
                    html += '</td>';
                    html += '</tr>';

                    $("table tbody").append(html);

                }
            })
        }
        getList(1);
//    })
</script>
{% endblock %}